<?php

class OembedComponent extends Object {
	var $oembed_endpoint = 'http://www.vimeo.com/api/oembed.json?url={url}';

	function get_data($url){
			$endpoint = $this->oembed_endpoint;
			$json = $this->provideJSON($url, $endpoint);
			$json = str_replace("\n","",$json);
			$json = str_replace("	","",$json);
			return json_decode($json);
	}

	function provideJSON($url, $endpoint){
		$fetch_url = preg_replace("/\{url\}/",urlencode($url), $endpoint);
		return file_get_contents($fetch_url);
	}

}
?>